<?php
declare (strict_types = 1);

namespace app\auth\model;

/**
 * @mixin \think\Model
 */
class DeptModel extends BaseModel
{
    protected $table = 'tb_depts';

    public function getCreateTimeAttr($value)
    {
        if(empty($value)) return 0;
        return date('Y-m-d H:i:s', $value);
    }

    const WITH_ROLES = 'roles';
    public function roles()
    {
        return $this->hasMany('app\auth\model\RoleModel', 'dept_id');
    }
}
